//
// Created by Administrator on 2025/4/21/周一.
//
#include "iostream"

using namespace std;

class Person {
public:
    int m_Age;
    mutable int m_B;

//    this指针的本质是一个指针常量，它的指向是不可以发生改变的
//    等价于 Person * const this;
    void showPerson() const {
//        this->m_Age = 100;
        this->m_B = 200;
        cout << "m_B = " << m_B << endl;
    }

//    会报错，因为常函数中只能修改常变量
    void MyFunc() const {
//mA = 10000;
    }
};


void test01() {
    Person p1;
    p1.m_Age = 100;
    p1.m_B = 300;
    cout << "age = " << p1.m_Age << endl;
    cout << "B = " << p1.m_B << endl;
    //常对象访问成员函数
    p1.MyFunc(); //常对象不能调用const的函数

}

int main() {
//    Person p1;
//    p1.showPerson();
    test01();
}